/*	$Id: md5.h 16 2008-07-29 04:54:06Z phrakt $	*/
/*	$OpenBSD: md5.h,v 1.16 2004/06/22 01:57:30 jfb Exp $	*/

/*
 * This code implements the MD5 message-digest algorithm.
 * The algorithm is due to Ron Rivest.  This code was
 * written by Colin Plumb in 1993, no copyright is claimed.
 * This code is in the public domain; do with it what you wish.
 *
 * Equivalent code is available from RSA Data Security, Inc.
 * This code has been tested against that, and is equivalent,
 * except that you don't need to include two pages of legalese
 * with every copy.
 */

#ifndef _PFORGE_MD5_H_
#define _PFORGE_MD5_H_

#include <pfnet/pforge.h>

#define	PF_MD5_BLOCK_LENGTH		64
#define	PF_MD5_DIGEST_LENGTH		16
#define	PF_MD5_DIGEST_STRING_LENGTH	(PF_MD5_DIGEST_LENGTH * 2 + 1)

typedef struct pf_md5 pf_md5_t;

void   pf_md5_init       (pf_md5_t *);
void   pf_md5_update     (pf_md5_t *, const uint8_t *, size_t);
void   pf_md5_pad        (pf_md5_t *);
void   pf_md5_final      (uint8_t [PF_MD5_DIGEST_LENGTH], pf_md5_t *);
void   pf_md5_transform  (uint32_t [4], const uint8_t [PF_MD5_BLOCK_LENGTH]);
char*  pf_md5_end        (pf_md5_t *, char *);
char*  pf_md5_file       (const char *, char *);
char*  pf_md5_filechunk  (const char *, char *, off_t, off_t);
char*  pf_md5_data       (const uint8_t *, size_t, char *);

#endif	/* _PFORGE_MD5_H_ */
